package com.yiyun.blog.controller;

import com.yiyun.blog.service.SysUserService;
import com.yiyun.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Bao
 * @create 2022-03-04-16:50
 */
@RestController
@RequestMapping("users")
public class UsersController {

    @Autowired
    SysUserService sysUserService;

    //使用http协议Header中的Authorization传递token
    @GetMapping("currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){

        return sysUserService.findUserByToken(token);
    }
}
